10 PROGNO$ = "Ver. 1.2 92-01-10"
15 NORDIS1$ = "FP-APPLICATION" : NORDIS2$ = "VERSION 1.2"
20 GOSUB 700000 : 'Initiate
100000 'Error routine 
100010 EFLAG% = ERR
100050 'PRINT EFLAG%:'Activate for debug 
100060 LASTERROR% = EFLAG%
100200 RESUME NEXT
160000 'PRINT "Last error = ";LASTERROR%:'Activate for debug
160050 'IF LASTERROR%<>0 THEN PRINT "At line ";ERL
160100 LASTERROR% = 0
160200 RETURN
200000 'Error handling routine 
200010 IF EFLAG% = 1006 THEN GOTO 200040 : ' Formfeed instead of print
200020 LED ( 1 ) ON : LED ( 0 ) OFF : BUSY
200030 SOUND 400 , 10
200040 IF EFLAG% = 1031 THEN GOSUB 300000
200050 IF EFLAG% = 1005 THEN GOSUB 310000
200060 IF EFLAG% = 1006 THEN GOSUB 320000
200070 IF EFLAG% = 1022 THEN GOSUB 330000
200080 IF EFLAG% = 1027 THEN GOSUB 340000
200090 DISP1$ = NORDIS1$ : DISP2$ = NORDIS2$
200100 GOSUB 600000
200110 LED ( 1 ) OFF : LED ( 0 ) ON : READY
200400 RETURN
300000 'Error 1031 Next label not found
300010 DISP1$ = "LABEL NOT FOUND"
300020 DISP2$ = "ERR NO. " + STR$ ( ERR )
300030 GOSUB 600000
300040 EFLAG% = 0
300050 FORMFEED
300060 IF EFLAG% = 1031 THEN GOTO 300040
300200 RETURN
310000 'Error 1005 Out of paper
310010 DISP1$ = "OUT OF PAPER"
310020 DISP2$ = "ERR NO. " + STR$ ( ERR )
310030 GOSUB 600000
310040 IF ( PRSTAT AND 1 ) = 0 THEN GOTO 310040 : ' Wait until head lifted
310050 EFLAG% = 0
310060 IF ( PRSTAT AND 1 ) = 0 THEN FORMFEED ELSE GOTO 310060
310070 IF EFLAG% = 1005 THEN GOTO 310040
310080 IF EFLAG% = 1031 THEN GOSUB 300000
310200 RETURN
320000 'Error 1006 no field to print   
320010 GOSUB 400000
320200 RETURN
330000 'Error 1022 Head lifted   
330010 DISP1$ = "HEAD LIFTED"
330020 DISP2$ = "ERR NO. " + STR$ ( ERR )
330030 GOSUB 600000
330040 IF ( PRSTAT AND 1 ) THEN GOTO 330040
330050 FORMFEED
330060 IF PCOMMAND% THEN GOSUB 500000
330200 RETURN
340000 'Error 1027 Out of transfer ribbon
340010 DISP1$ = "OUT OF RIBBON"
340020 DISP2$ = "ERR NO. " + STR$ ( ERR )
340030 GOSUB 600000
340040 IF ( PRSTAT AND 8 ) THEN GOTO 340040
340050 GOSUB 1500000
340200 IF PCOMMAND% THEN GOSUB 500000
349000 RETURN
400000 'Feed routine  
400010 EFLAG% = 0
400020 FORMFEED
400200 IF EFLAG% <> 0 THEN GOSUB 200000
400300 RETURN
500000 'Print routine   
500010 EFLAG% = 0
500020 PCOMMAND% = 1
500030 PRINTFEED
500040 IF EFLAG% <> 0 THEN GOSUB 200000
500100 PCOMMAND% = 0
500300 RETURN
600000 'Display handler   
600010 PRINT # 10
600020 PRINT # 10
600030 PRINT # 10 , DISP1$
600040 PRINT # 10 , DISP2$ ;
600200 RETURN
700000 'Init routine
700010 ON ERROR GOTO 100000
700020 OPEN "console:" FOR OUTPUT AS # 10
700030 DISP1$ = NORDIS1$ : DISP2$ = NORDIS2$
700040 GOSUB 600000
700100 ON KEY ( 15 ) GOSUB 1500000 : 'PAUSE
700110 ON KEY ( 17 ) GOSUB 1700000 : 'PRINT
700120 ON KEY ( 18 ) GOSUB 1800000 : 'SETUP
700130 ON KEY ( 19 ) GOSUB 1900000 : 'FEED
700140 KEY ( 15 ) ON
700150 KEY ( 17 ) ON
700160 KEY ( 18 ) ON
700170 KEY ( 19 ) ON
700230 LED ( 0 ) ON
700240 LED ( 1 ) OFF
700300 PAUSE% = 0
700500 RETURN
1500000 'Pause function
1500010 KEY ( 15 ) ON
1500020 PAUSE% = PAUSE% XOR 1
1500030 BUSY : LED ( 0 ) OFF
1500040 DISP1$ = "Press <PAUSE>" : DISP2$ = "to continue"
1500050 GOSUB 600000
1500060 IF PAUSE% = 0 THEN GOTO 1500100
1500070 SOUND 131 , 2
1500080 SOUND 30000 , 20
1500090 IF PAUSE% THEN GOTO 1500070
1500100 READY : LED ( 0 ) ON
1500110 DISP1$ = NORDIS1$ : DISP2$ = NORDIS2$
1500120 GOSUB 600000
1502000 RETURN
1700000 'Printkey  
1700010 KEY ( 17 ) OFF
1700020 GOSUB 500000
1700030 KEY ( 17 ) ON
1700200 RETURN
1800000 'Setup key
1800010 KEY ( 18 ) OFF
1800020 LED ( 0 ) OFF
1800030 BUSY
1800040 SETUP
1800050 READY
1800060 LED ( 0 ) ON
1800080 KEY ( 18 ) ON
1800090 DISP1$ = NORDIS1$ : DISP2$ = NORDIS2$
1800100 GOSUB 600000
1800200 RETURN
1900000 'Feedkey
1900010 KEY ( 19 ) OFF
1900020 GOSUB 400000
1900030 KEY ( 19 ) ON
1900200 RETURN
